<template>
  <div class="advice" v-bolang="'#aaa'">
    <div class="advice-title">
      {{ adviceItem.realname }}
      <span class="advice-title-time">{{ time(adviceItem.time) }}</span>
    </div>
    <div class="advice-content">{{ adviceItem.content }}</div>
    <div class="advice-cir"></div>
  </div>
</template>

<script setup lang="ts">
import { adviceType } from "@/type/advice";
import { defineProps, toRefs, computed } from "vue";
import { formatTime } from "@/formatTime";
type TAdvice = {
  adviceItem: adviceType;
};
const props = defineProps<TAdvice>();
const { adviceItem } = toRefs(props);
const time = computed(() => {
  return (val: string) => {
    return formatTime(val);
  };
});
</script>

<style lang="scss" scoped>
.advice {
  position: relative;
  margin: 12px 10px;
  background-color: $mihuang-color;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 3px 6px 0 $qian-shadow;
  &-title {
    color: $font-color;
    margin-bottom: 8px;
    font-size: 14px;
    &-time {
      color: #888;
      font-size: 12px;
    }
  }
  &-content {
    font-size: 14px;
  }
  &-cir {
    width: 15px;
    height: 15px;
    border-radius: 15px;
    background-color: #fff;
    top: 12px;
    right: 12px;
    position: absolute;
  }
}
</style>
